const {
  DataTypes
} = require('sequelize');
module.exports = sequelize => {
  const attributes = {
    id: {
      type: DataTypes.INTEGER(10).UNSIGNED,
      allowNull: false,
      defaultValue: null,
      primaryKey: true,
      autoIncrement: true,
      comment: "自增id",
      field: "id"
    },
    order_id: {
      type: DataTypes.INTEGER(10).UNSIGNED,
      allowNull: false,
      defaultValue: "0",
      primaryKey: false,
      autoIncrement: false,
      comment: "订单id",
      field: "order_id"
    },
    original_status: {
      type: DataTypes.STRING(60),
      allowNull: false,
      defaultValue: "",
      primaryKey: false,
      autoIncrement: false,
      comment: "原始状态",
      field: "original_status"
    },
    new_status: {
      type: DataTypes.STRING(60),
      allowNull: false,
      defaultValue: "",
      primaryKey: false,
      autoIncrement: false,
      comment: "最新状态",
      field: "new_status"
    },
    msg: {
      type: DataTypes.TEXT,
      allowNull: true,
      defaultValue: null,
      primaryKey: false,
      autoIncrement: false,
      comment: "操作描述",
      field: "msg"
    },
    creator: {
      type: DataTypes.INTEGER(10).UNSIGNED,
      allowNull: false,
      defaultValue: "0",
      primaryKey: false,
      autoIncrement: false,
      comment: "创建-用户id",
      field: "creator"
    },
    creator_name: {
      type: DataTypes.STRING(60),
      allowNull: false,
      defaultValue: "",
      primaryKey: false,
      autoIncrement: false,
      comment: "创建人-姓名",
      field: "creator_name"
    },
    add_time: {
      type: DataTypes.INTEGER(10).UNSIGNED,
      allowNull: false,
      defaultValue: "0",
      primaryKey: false,
      autoIncrement: false,
      comment: "创建时间",
      field: "add_time"
    }
  };
  const options = {
    tableName: "sxo_order_status_history",
    comment: "",
    indexes: [{
      name: "order_id",
      unique: false,
      type: "BTREE",
      fields: ["order_id"]
    }, {
      name: "original_status",
      unique: false,
      type: "BTREE",
      fields: ["original_status"]
    }, {
      name: "new_status",
      unique: false,
      type: "BTREE",
      fields: ["new_status"]
    }]
  };
  const SxoOrderStatusHistoryModel = sequelize.define("sxo_order_status_history_model", attributes, options);
  return SxoOrderStatusHistoryModel;
};